package bairui.international.console.web.controller.user.royalty;

/**
 * @see bairui.international.console.web.controller.user.royalty.Page_BaseFilter
 *
 */
class Page_Filter

{
	
	/**
	 * 过滤扩展接口
	 */
	static interface FilterExtends {
		com.querydsl.core.types.Predicate gainNumber(
			String number
		);
		com.querydsl.core.types.Predicate gainUserName(
			String userName
		);
		com.querydsl.core.types.Predicate gainState(
			bairui.international.model.status.State_ProductOrder state
		);
		com.querydsl.core.types.Predicate gainPayWay(
			bairui.international.model.type.Type_ProductOrderPay payWay
		);
		com.querydsl.core.types.Predicate gainSubmitDate_start(
			java.util.Date submitDate
		);
		com.querydsl.core.types.Predicate gainSubmitDate_end(
			java.util.Date submitDate
		);
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_BranchCompanyStaffRoyaltyRecord QRoot,
		javax.servlet.http.HttpServletRequest request
		,FilterExtends filterExtends
	) {
		com.querydsl.core.BooleanBuilder query = query(
				QRoot
			);
			/* comment 附加过滤属性 */
			if(null != request.getParameter("number")){
				query.and(filterExtends.gainNumber(
					com.sh_lianjing.string.util.Util_String.parseToType(
							request.getParameter("number"), 
							String.class, 
							"yyyy-MM-dd"
						)
				));
			}
			if(null != request.getParameter("userName")){
				query.and(filterExtends.gainUserName(
					com.sh_lianjing.string.util.Util_String.parseToType(
							request.getParameter("userName"), 
							String.class, 
							"yyyy-MM-dd"
						)
				));
			}
			if(null != request.getParameter("state")){
				query.and(filterExtends.gainState(
					com.sh_lianjing.string.util.Util_String.parseToType(
							request.getParameter("state"), 
							bairui.international.model.status.State_ProductOrder.class, 
							"yyyy-MM-dd"
						)
				));
			}
			if(null != request.getParameter("payWay")){
				query.and(filterExtends.gainPayWay(
					com.sh_lianjing.string.util.Util_String.parseToType(
							request.getParameter("payWay"), 
							bairui.international.model.type.Type_ProductOrderPay.class, 
							"yyyy-MM-dd"
						)
				));
			}
			if(null != request.getParameter("submitDate_start")){
				query.and(filterExtends.gainSubmitDate_start(
					com.sh_lianjing.string.util.Util_String.parseToType(
							request.getParameter("submitDate_start"), 
							java.util.Date.class, 
							"yyyy-MM-dd"
						)
				));
			}
			if(null != request.getParameter("submitDate_end")){
				query.and(filterExtends.gainSubmitDate_end(
					com.sh_lianjing.string.util.Util_String.parseToType(
							request.getParameter("submitDate_end"), 
							java.util.Date.class, 
							"yyyy-MM-dd"
						)
				));
			}
	;
		return query;
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_BranchCompanyStaffRoyaltyRecord QRoot
	) {
		com.querydsl.core.BooleanBuilder builder = new com.querydsl.core.BooleanBuilder();
	
		return builder;
	}
	
}
